{{include file="header_inc.html"}}
<body>
	<div class="subnav">
		<div class="content-menu ib-a blue line-x">
			<a href='javascript:;' class="on"><em>数据库管理</em></a><span>|</span> <a
				href='/extend/databases/export/'><em>数据库导出</em></a><span>|</span> <a
				href='/extend/databases/import/'><em>数据库导入</em></a>
		</div>
	</div>
	<div class="pad_10">
		<table width="100%" cellspacing="0" class="search-form">
			<tbody>
				<tr>
					<td>
						<div class="explain-col">友情提示:数据表长期运行之后可能数据损坏或速度下降，这时可以尝试修复/优化表。</div>
					</td>
				</tr>
			</tbody>
		</table>

		<div class="table-list">
			<form method="post" name="myform" id="myform"
				action="/extend/databases/batch/">
				<table width="100%" cellspacing="0">
					<thead>
						<tr>
							<th width="10%"><input type="checkbox" value=""
								id="check_box" onclick="selectall('tables[]');"></th>
							<th width="10%">表名</th>
							<th width="10%">类型</th>
							<th width="10%">编码</th>
							<th width="15%">记录数</th>
							<th width="15%">使用空间</th>
							<th width="15%">碎片</th>
							<th width="15%">操作</th>
						</tr>
					</thead>
					<tbody>
						{{foreach key=key item=content from=$tables}}
						<tr>
							<td width="5%" align="center"><input type="checkbox"
								name="tables[]" value="{{$content.Name}}" /></td>
							<td width="10%" align="center">{{$content.Name}}</td>
							<td width="10%" align="center">{{$content.Engine}}</td>
							<td width="10%" align="center">{{$content.Collation}}</td>
							<td width="15%" align="center">{{$content.Rows}}</td>
							<td width="15%" align="center">{{$content.Size}}</td>
							<td width="15%" align="center">{{$content.Data_free}}</td>
							<td width="15%" align="center"><a
								href="/extend/databases/operation/optimize/tables/{{$content.Name}}/">优化</a>
								| <a
								href="/extend/databases/operation/repair/tables/{{$content.Name}}/">修复</a>
								| <a href="javascript:void(0);"
								onclick="showcreat('{{$content.Name}}')">结构</a></td>
						</tr>
						{{/foreach}}
					</tbody>
				</table>
				<div class="btn">
					<label for="check_box">批量操作：</label> <input id="dosubmit"
						name="dosubmit" type="hidden" value=""> <input
						type="button" class="button" onclick="batch('optimize')"
						value="批量优化" /> <input type="button" class="button"
						onclick="batch('repair')" value="批量修复" />
				</div>
			</form>
		</div>
	</div>
</body>
<script type="text/javascript">
<!--
	function showcreat(tblname) {
		window.top.art.dialog({
			title : tblname + ' 表结构',
			id : 'show',
			iframe : '/extend/databases/showtable/tables/' + tblname + '/',
			width : '600px',
			height : '450px'
		});
	}

	//批量操作
	function batch(type) {
		if (type == '') {
			return false;
		}

		var isSelect = false;

		$("input[name='tables[]']").each(function() {
			if (this.checked == true) {
				isSelect = true;
			}
		});

		if (isSelect == false) {
			window.top.art.dialog({
				title : '提示',
				content : '请至少选择一项！',
				icon : 'error',
				ok : true
			});
			return;
		}

		$("#dosubmit").val(type);
		$("form").submit();
	}
//-->
</script>
{{include file="footer.html"}}
